package com.edu.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ProjectName: myApp
 * @Titile: ProductController
 * @Author: Administrator
 * @Description: TODO
 */
@RestController
@RequestMapping("/product")
@Slf4j
@RefreshScope //开启配置信息自动更新
public class ProductController {
    @Value("${product.discount}")
    private Float discount;
    @Value("${server.port}")
    private String port;

    @GetMapping("discount")
    public Object getDiscount(){
        log.info("获取到的商品折扣:{}",discount);
        return "商品的折扣:"+discount+",服务提供者的端口："+port;
    }
}
